#ifndef PRINTTEMPLATE_H
#define PRINTTEMPLATE_H

#include <QWidget>
#include "printtemplatepreview.h"
#include "commonfunction.h"
#include "blldataflow.h"
#include <QPrinter>
#include "globaldef.h"
#include "constants.h"

namespace Ui {
class PrintTemplate;
}

class PrintTemplate : public QWidget
{
    Q_OBJECT

public:
    explicit PrintTemplate(QWidget *parent = nullptr);
    ~PrintTemplate();
    void generateHeaderHtml();
    void generateTailHtml();

private slots:
    void on_btnPreview_clicked();
    void on_btnSave_clicked();
    void on_btnReturn_clicked();

    void savePdfSucceedSlot(int type);
    void retranslateUiSlot();

signals:
    void setPageSizeSignal(int pageSize);
    void updatePrintParamSignal();

private:
    void initWidget();
    void readParam();//Read print parameters
    void saveParam();//Save print parameters

private:
    Ui::PrintTemplate *ui;
    PrintTemplatePreview * printTemplatePreview;
    BllDataFlow * bdf;
    QString headerHtml;
    QString tailHtml;

    bool companyChecked;
    bool equipmentChecked;
    bool serialChecked;
    bool userChecked;
    bool datetimeChecked;
    int pageSize;
    QString companyName;
    QString equipName;
    QString equipModel;
    QString equipSerial;
    QString username;
    QString datetime;

};

#endif // PRINTTEMPLATE_H
